1
|
|
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.inherits = f()}})(function(){var define,module,exports;module={exports:(exports={})}; |
2
|
|
|
/*! |
3
|
|
|
* inherits.js | v0.2.0 | Easily inherit prototypes. |
4
|
|
|
* Copyright (c) 2017 Eric Zieger (MIT license) |
5
|
|
|
* https://github.com/theZieger/inherits.js/blob/master/LICENSE |
6
|
|
|
* |
7
|
|
|
* inherit the prototype of the SuperConstructor |
8
|
|
|
* |
9
|
|
|
* Warning: Changing the prototype of an object is, by the nature of how |
10
|
|
|
* modern JavaScript engines optimize property accesses, a very slow |
11
|
|
|
* operation, in every browser and JavaScript engine. So instead of using |
12
|
|
|
* Object.setPrototypeOf or messing with __proto__, we create a new object |
13
|
|
|
* with the desired prototype using Object.create(). |
14
|
|
|
* |
15
|
|
|
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Object/setPrototypeOf |
16
|
|
|
* |
17
|
|
|
* @param {Object} Constructor |
18
|
|
|
* @param {Object} SuperConstructor |
19
|
|
|
* |
20
|
|
|
* @throws {TypeError} if arguments are `null`, `undefined`, or |
21
|
|
|
* `SuperConstructor` has no prototype |
22
|
|
|
* |
23
|
|
|
* @returns {Void} |
24
|
|
|
*/ |
25
|
|
|
module.exports = function(Constructor, SuperConstructor) { |
26
|
|
|
if (Constructor === undefined || Constructor === null) { |
27
|
|
|
throw new TypeError('Constructor argument is undefined or null'); |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
if (SuperConstructor === undefined || SuperConstructor === null) { |
31
|
|
|
throw new TypeError('SuperConstructor argument is undefined or null'); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
if (SuperConstructor.prototype === undefined) { |
35
|
|
|
throw new TypeError('SuperConstructor.prototype is undefined'); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* for convenience, `SuperConstructor` will be accessible through the |
40
|
|
|
* `Constructor.super_` property |
41
|
|
|
*/ |
42
|
|
|
Constructor.super_ = SuperConstructor; |
43
|
|
|
|
44
|
|
|
Constructor.prototype = Object.create(SuperConstructor.prototype); |
45
|
|
|
Constructor.prototype.constructor = Constructor; |
46
|
|
|
}; |
47
|
|
|
|
48
|
|
|
return module.exports;}); |
49
|
|
|
|